package dji.ux.ext.panel.camera;

import dji.common.camera.CameraVideoStreamSource;
import dji.common.camera.SettingsDefinitions;
import dji.common.camera.ThermalMeasurementMode;

public class CameraUtil {

    static String getVideoSourceName(CameraVideoStreamSource streamSource) {
        switch (streamSource) {
            case WIDE:
                return "广角";
            case ZOOM:
                return "变焦";
            case INFRARED_THERMAL:
                return "红外";
            default:
                return "未知";
        }
    }

    static String getDisplayModeName(SettingsDefinitions.DisplayMode displayMode) {

        switch (displayMode) {
            case VISUAL_ONLY:
                return "可见光";
            case THERMAL_ONLY:
                return "红外";
            case MSX:
                return "融合";
            case PIP:
                return "分屏";
        }

        return "其他";
    }

    static String getMeasurementModeName(ThermalMeasurementMode mode) {

        switch (mode) {
            case DISABLED:
                return "关闭";
            case AREA_METERING:
                return "区域测温";
            case SPOT_METERING:
                return "指点测温";
        }

        return "关闭";
    }


    static String getZoomToText(SettingsDefinitions.ThermalDigitalZoomFactor thermalDigitalZoomFactor) {
        switch (thermalDigitalZoomFactor) {
            case X_1:
                return "x1";
            case X_2:
                return "x2";
            case X_4:
                return "x4";
            case X_8:
                return "x8";
        }

        return "x1";
    }

    static SettingsDefinitions.ThermalDigitalZoomFactor getTextToZoom(String text) {
        switch (text) {
            case "x1":
                return SettingsDefinitions.ThermalDigitalZoomFactor.X_2;
            case "x2":
                return SettingsDefinitions.ThermalDigitalZoomFactor.X_4;
            case "x4":
                return SettingsDefinitions.ThermalDigitalZoomFactor.X_8;
            case "x8":
                return SettingsDefinitions.ThermalDigitalZoomFactor.X_1;
        }

        return SettingsDefinitions.ThermalDigitalZoomFactor.X_1;
    }

    static ThermalMeasurementMode getMeasureModeFromIndex(int index) {
        switch (index) {
            case 0:
                return ThermalMeasurementMode.DISABLED;
            case 1:
                return ThermalMeasurementMode.AREA_METERING;
            case 2:
                return ThermalMeasurementMode.SPOT_METERING;
        }

        return ThermalMeasurementMode.DISABLED;
    }


}
